<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	xmlns:pe="http://primefaces.org/ui/extensions"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:fn="http://java.sun.com/jsp/jstl/functions">

	<h:form id="form_main_top">
		<p:contextMenu for="data_table">
			<p:menuitem value="#{msg['wallet.app.button.delete']}"
				process="@this" update=":form_action" icon="ui-icon-close"
				oncomplete="document.getElementById('form_action:btnDelete').click();" />
		</p:contextMenu>
		
		<p:dataTable id="data_table" var="item" 
					value="#{recordBean.lstRecord}" scrollRows="20"  
					rowStyleClass="#{item.status eq true ? 'disabled' : null}"
					emptyMessage="#{msg['wallet.app.record.table.noRecordFound']}"
                    scrollable="true" liveScroll="true" scrollHeight="150" >

			<p:ajax event="contextMenu" update=":form_action" />
			<p:ajax event="rowSelect" update=":form_action" />

			<p:column headerText="ID" sortBy="#{item.id}">
				<h:outputText value="#{item.id}" />
			</p:column>

			<p:column headerText="Category" filterBy="#{record.category}"
				filterOptions="#{recordBean.categoryOption}"
				filterMatchMode="exact">
				<p:selectBooleanCheckbox disabled="true" value="#{category.status}" />
			</p:column>

			<p:column headerText="Description" filterBy="#{record.description}">
				<h:outputText value="#{record.description}" />
			</p:column>

			<p:column headerText="Amount" filterBy="#{record.amount}"
				sortBy="#{record.amount}">
				<h:outputText value="#{record.amount}" />
			</p:column>

			<p:column headerText="date" filterBy="#{record.status}"
				filterOptions="#{recordBean.booleanStatusOption}"
				filterMatchMode="exact">
				<p:selectBooleanCheckbox disabled="true" value="#{item.status}" />
			</p:column>
		</p:dataTable>
	</h:form>
	
	<h:form id="form_action">
		<h:panelGrid id="record_action" columns="3">
			<p:commandButton actionListener="#{recordBean.prepareItem(0)}"
				value="#{msg['wallet.app.button.addNew']}" id="btnAdd"
				process="@this" 
				oncomplete="newrecordDialogVar.show();" />

			<p:commandButton actionListener="#{recordBean.prepareItem(1)}"
				value="#{msg['wallet.app.button.update']}" id="btnUpdate"
				process="@this" 
				oncomplete="newrecordDialogVar.show();" />

			<p:commandButton value="#{msg['wallet.app.button.delete']}"
				id="btnDelete" process="@this"
				oncomplete="confirmDialogVar.show()" />
		</h:panelGrid>
	</h:form>


	
</ui:composition>